<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>查验货物查看页面</title>
    <link rel="stylesheet" type="text/css"
          href="../../css/jquery/jquery-ui-1.8.23.custom.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="../../js/semanticUI/dist/semantic.min.css">
    <link href="../../css/jw/jw.css" rel="stylesheet" type="text/css"/>
    <script src="../../js/jquery/jquery-1.8.0.min.js"></script>
    <script src="../../js/semanticUI/dist/semantic.min.js"></script>
    <script src="../../js/jquery/jquery-1.12.4.min.js"></script>
    <script src="../../js/jquery/jquery-migrate-1.2.1.min.js"></script>
    <script src="../../js/jquery/jquery-ui.js"></script>
    <script type="text/javascript"
            src="../../js/jquery/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    <script type="application/javascript" src="../../js/gtimp3/declaration.js"></script>
    <script type="application/javascript" src="../../js/jw/jw.js"></script>
    <script>
        $(document).ready(function () {
            $("#inspection_ext_company").hide();
            $("#inspection_company").on('change', function () {
                var selectValue = $(this).val();
                if (selectValue && selectValue == "其他") {
                    $("#inspection_ext_company").show();
                } else {
                    $("#inspection_ext_company").hide();
                }
            });

            $("#inspection_time").datepicker();
            $("#updateBtn").on('click', function () {
                doUpdateInfo();
            });
        });

        function doUpdateInfo() {
            $.ajax({
                       url: "./doUpdateInfo",
                       dataType: "json",
                       data: $('#inspectionForm').serialize(),
                       success: function (data) {
                           alert(data.msg);
                           window.location.reload();
                       }
                   });
        }
    </script>
</head>

<body>
<form id="inspectionForm" onsubmit="return false;">
    <input type="hidden" name="inspectionId" value="${inspectionGoods.id}">
    <input type="hidden" name="declarationId" value="${declaration.id}">
    <div class="ui form segment">
        <div class="three fields">
            <div class="inline field">
                <label>查验柜号：</label>
                <c:choose>
                    <c:when test="${empty inspectionGoods.containerNo}">
                        <select id="container_no_select" name="container_no" style="width: 400px;">
                            <c:set value="${fn:split(declaration.container_no, ',')}"
                                   var="container_no_array"></c:set>
                            <c:forEach items="${container_no_array}" var="container_no">
                                <option value="${container_no}">${container_no}</option>
                            </c:forEach>
                        </select>
                    </c:when>
                    <c:otherwise>
                        <input type="text" style="width: 400px;" id="container_no"
                               name="container_no" value="${inspectionGoods.containerNo}" readonly>
                    </c:otherwise>
                </c:choose>
            </div>
            <div class="inline field">
                <label>报关单号：</label>
                <input placeholder="输入报关单号" type="text" style="width: 400px;"
                       value="${declaration.sno}" readonly>
            </div>
            <div class="inline field">
                <label>业务编号：</label>
                <input placeholder="输入业务编号" type="text" style="width: 400px;"
                       value="${declaration.businessId}" readonly>
            </div>
        </div>
        <div class="three fields">
            <div class="inline field">
                <label>实际托运人</label>
                <input type="hidden" value="${declaration.shipper.id}" readonly>
                <input placeholder="输入实际托运人" type="text" style="width: 400px;"
                       value="${declaration.shipper.name}" readonly>
            </div>
            <div class="inline field">
                <label>收发货人：</label>
                <input type="hidden" value="${declaration.company_co}" readonly>
                <input placeholder="输入收发货人" type="text" style="width: 400px;"
                       value="${declaration.company_name}" readonly>
            </div>
        </div>
        <div class="inline field">
            <label>查验记录</label>
            <textarea readonly>${inspectionContent}</textarea>
        </div>
        <div class="three fields">
            <div align="center" style="width: 100%;">
                <div class="ui button" onclick="javascript:history.back(-1);"> 返回</div>
            </div>
        </div>
</form>
</body>
</html>
